package com.dianxin.smartpark.web.park;

import java.util.List;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.chinatelecom.response.common.CommonResponseBody;
import com.dianxin.smartpark.dao.qo.park.SmartParkCarParkParkingQO;
import com.dianxin.smartpark.service.park.SmartParkCarParkParkingService;
import com.dianxin.smartpark.service.vo.park.SmartParkCarParkParkingVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 停车记录
 * 
 * @author chenjiasong
 * @date 2021-07-28
 */
@RestController
@RequestMapping("/smartpark/parking")
public class SmartParkCarParkParkingController
{
    @Resource
    private SmartParkCarParkParkingService smartParkCarParkParkingService;

    /**
     * 查询停车记录列表
     */
    @PostMapping("/list")
    @SaCheckPermission(value = "/smartpark/parking/list")
    public CommonResponseBody<List<SmartParkCarParkParkingVO>>  list(@RequestBody SmartParkCarParkParkingQO qo)
    {
        return smartParkCarParkParkingService.selectSmartParkCarParkParkingList(qo);
    }


    /**
     * 获取停车记录详细信息
     */
    @GetMapping(value = "/getInfo")
    @SaCheckPermission(value = "/smartpark/parking/getInfo")
    public CommonResponseBody<SmartParkCarParkParkingVO> getInfo(SmartParkCarParkParkingQO qo)
    {
        return smartParkCarParkParkingService.selectSmartParkCarParkParking(qo);
    }

    /**
     * 新增停车记录
     */
    @PostMapping("/add")
    @SaCheckPermission(value = "/smartpark/parking/add")
    public  CommonResponseBody<Boolean> add(@RequestBody SmartParkCarParkParkingVO vo)
    {
        return smartParkCarParkParkingService.insertSmartParkCarParkParking(vo);
    }

    /**
     * 修改停车记录
     */
    @PutMapping("/edit")
    @SaCheckPermission(value = "/smartpark/parking/edit")
    public  CommonResponseBody<Boolean> edit(@RequestBody SmartParkCarParkParkingVO vo)
    {
        return smartParkCarParkParkingService.updateSmartParkCarParkParking(vo);
    }

    /**
     * 删除停车记录
     */
	@DeleteMapping("/remove")
    @SaCheckPermission(value = "/smartpark/parking/remove")
    public  CommonResponseBody<Boolean> remove(@RequestBody SmartParkCarParkParkingVO vo)
    {
        return smartParkCarParkParkingService.deleteSmartParkCarParkParking(vo);
    }
}
